# Path to the common makefiles
SHARE = ../../make

PROGRAM = stereo

# Name and type of the (sub)project
CPP_PROGRAM = $(PROGRAM)

# Version number
MAJOR = 1
MINOR = 0
REVISION = 3

# Add extra files to the distribution
DISTFILES = sctest.sc

SCC = ../skeletons/scc.py
MCC = ../skeletons/merge.py

MAINSOURCE = main.cpp
SCSOURCE = $(addsuffix .sc, $(PROGRAM))
CSOURCE  = $(addsuffix .c, $(PROGRAM))
MSOURCE  = $(addsuffix -merge.c, $(PROGRAM))
EXTRA_SOURCES = $(CSOURCE) $(MSOURCE) $(MAINSOURCE)

.SECONDARY: $(EXTRA_SOURCES)
.PRECIOUS: $(EXTRA_SOURCES)

# Include the common makefile
include $(SHARE)/include.make

# Extra variables
LIBS   += -lm

USELIBS = log timer memfs sc scu scc scsim scilp

include ../sc.make

$(CSOURCE) $(MAINSOURCE): $(SCSOURCE)
	$(SCC) $(PROGRAM)

$(MSOURCE):: $(SCSOURCE) $(MAINSOURCE) $(PROGRAM)-availability.xml $(PROGRAM)-colocation.xml
	$(MCC) $(PROGRAM)

$(PROGRAM)-colocation.xml:
	echo "<document><colocation></colocation><affinity></affinity></document>" > $@

clean: myclean
myclean:
	rm -f $(EXTRA_SOURCES) $(PROGRAM)-availability.xml $(PROGRAM)-availability.txt

